<template>
    <el-upload class="upload-demo" drag action="" :show-file-list="true" :auto-upload="false" :limit="limitNum" accept=".zip,"
        :on-change="handleChange" >
        <el-icon class="el-icon--upload"><upload-filled /></el-icon>
        <div class="el-upload__text">
            将文件拖拽到此处 <em>点击上传</em>
        </div>
        <template #tip>
            <div class="el-upload__tip">
                只能上传一个文件（后缀为.zip）,大小不超过10MB
            </div>
        </template>
    </el-upload>
</template>

<script>
import { reactive, getCurrentInstance, ref } from 'vue';

export default {
    name: "upload",
    props: {
        action: {
            default: '#',
            type: String,
        },
        limitNum: {
            default: 1,
            type: Number,
        },
    },
    emits: ['onchange'],

    setup(props,{emit}) {
        const { proxy } = getCurrentInstance()
        //let waitFileList = ref([])
        //waitFileList.value = props.fileList
        // 上传文件数组
        const fileList = ref([])

        // 文件改变时回调钩子
        const handleChange = (file, files) => {
            emit('onchange', file, files)
        }
        return {
            handleChange,
        }
    }
}
</script>

<style scoped></style>